package StudyCode.summary.Basic;

import java.util.EnumSet;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class UseEnumSet {
	public static void main(String[] args) {
		EnumSet<Day> allDays = EnumSet.allOf(Day.class);
		print(allDays, "All days: ");

		EnumSet<Day> weekDays = EnumSet.range(Day.MONDAY, Day.FRIDAY);
		print(weekDays, "Weekdays: ");

		EnumSet<Day> weekends = EnumSet.complementOf(weekDays);
		print(weekends, "Weekends: ");
	}

	public static void print(EnumSet<Day> days, String msg) {
		System.out.print(msg);
		for (Day day : days) {
			System.out.print(day + " ");
		}
		System.out.println();
	}
}

enum Day {
	MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY;
}